<template>
  <!--弹窗-->
  <el-dialog
    width="65%"
    :title="title"
    :visible.sync="visible"
    :before-close="handleClose">
    <el-form ref="formData" :model="formData" label-width="100px">
      <el-alert class="title" :closable="false" title="一、讲师基本信息" type="info" />
      <br/>
      <el-row>
        <el-col :span="12"><div>
          <el-form-item label="用户手机：">
            <el-input :disabled="true" v-model="formData.lecturerMobile"></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="12"><div>
          <el-form-item label="讲师名称：">
            <el-input v-model="formData.lecturerName"></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row>
        <el-col :span="12"><div>
          <el-form-item label="邮箱：">
            <el-input v-model="formData.lecturerEmail"></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="12"><div>
          <el-form-item label="排序：">
            <el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1"></el-input-number>
          </el-form-item>
        </div></el-col>
      </el-row>
<!--      <el-form-item label="讲师简介：">-->
<!--        <div id="introduce"></div>-->
<!--      </el-form-item>-->
      <el-alert class="title" :closable="false" title="二、讲师分成及银行信息" type="info" />
      <br/>
      <el-row>
        <el-col :span="12"><div>
          <el-form-item label="银行名称：">
            <el-input :disabled="true" v-model="lecturerExt.bankName"></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="12"><div>
          <el-form-item label="银行卡号：">
            <el-input :disabled="true" v-model="lecturerExt.bankCardNo"></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row>
        <el-col :span="12"><div>
          <el-form-item label="开户名称：">
            <el-input :disabled="true" v-model="lecturerExt.bankUserName"></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="12"><div>
          <el-form-item label="银行卡号：">
            <el-input :disabled="true" v-model="lecturerExt.bankIdCardNo"></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-form-item label="支行名称：">
        <el-input :disabled="true" v-model="lecturerExt.bankBranchName"></el-input>
      </el-form-item>
    </el-form>
    <el-row style="margin-top:17px; ">
      <el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
      <el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
    </el-row>
  </el-dialog>
</template>
<script>
export default {
  name: 'Edit',
  data() {
    return {
    }
  },
  props: {
    // route object
    formData: {
      type: Object,
      default: () => {}
    },
    lecturerExt: {
      type: Object,
      default: () => {}
    },
    title: {
      type: String,
      default: ''
    },
    visible: {
      type: Boolean,
      default: false
    },
  },
  methods: {
    handleClose(done) {
      this.$emit('close-callback')
    },
    handleChange(value) {
      this.formData.sort = value
    },
    submitForm(formData) {
      console.log(JSON.stringify(this.formData));
      this.$refs[formData].validate((valid) => {
        if (valid) {
          if (this.formData.id === undefined) {
            this.$message({
              type: 'error',
              message: "提交失败"
            });
          }else {
            this.$message({
              type: 'success',
              message: "提交成功"
            });
          }
        } else {
          this.$message({
            type: 'error',
            message: "提交失败"
          });
        }
      })
    }
  }
}
</script>

